package com.q.springboot.framework.util;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public final class GsonUtils {
    public GsonUtils() {
    }

    public static String toJsonStr(Object target) {
        return (new Gson()).toJson(target);
    }

    public static <T> T fromJsonStr(String str, Class<T> clz) {
        return (new Gson()).fromJson(str, clz);
    }

    public static <T> T fromJsonStr(String str, TypeToken<T> typeToken) {
        return (new Gson()).fromJson(str, typeToken.getType());
    }
}